home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / TURB_VIS / TVDMX / WORKSHOP.PAS < prev   
Pascal/Delphi Source File  |  1994-06-20  |  5KB  |  180 lines

  1.  
  2. {■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■}
  3. {                            }
  4. {    WORKSHOP  --generic tvDMX demo program        }
  5. {    tvDMX      --data editing project (ver 2.x)    }
  6. {                            }
  7. {    Copyright (c) 1992,93    Randolph Beck        }
  8. {                P.O. Box  56-0487    }
  9. {                Orlando, FL 32856    }
  10. {                CIS:  72361,753        }
  11. {                            }
  12. {■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■}
  13.  
  14. Program WORKSHOP;
  15.  
  16. {  This program was added to allow you to experiment with your own file
  17.    structures.    Just edit the strings xTemplate and xLabels and you will see
  18.    how easy it is to create new record structures --and what could go wrong
  19.    if you mix types or leave out field delimiters.
  20.  
  21.    A record structure does not need to be defined to the compiler because
  22.    this application uses a generic database of 8000 bytes(using the record
  23.    structure specified by the string xTemplate).
  24.  
  25.    All you need to do is edit xTemplate and xLabels: tvDMX will do the rest.
  26.  }
  27.  
  28. {$M 16384,16384,655360}
  29. {$V-,X+,D-,B-,R- }
  30.  
  31. uses
  32.     Objects, Drivers, Views, Menus, App,
  33.     RSet, DmxGizma, tvDMX, tvGizma, tvDMXREP;
  34.  
  35. const
  36.     xLabels    =  ' String Field            +Real         Real      Word   Seg : Ofs ';
  37.     xTemplate    =  ' ssssssssssssssssssss║RRRRRRR.ZZZR|($rr,rrr.zz)|WWWWW ║ HHHH:HHHH ';
  38.  
  39.     cmOpenWin    =  101;
  40.     cmPrint    =  102;
  41.  
  42.  
  43. type
  44.     PDmxInterior    = ^TDmxInterior;
  45.     TDmxInterior    =  OBJECT(TDmxEditor)
  46.  
  47.      { see documentation on tvDMX's virtual methods if you wish to
  48.        modify your tvDMX view's behavior  }
  49.  
  50.     end;
  51.  
  52.  
  53.     TAppN    =  OBJECT(TAppPrn)
  54.     end;
  55.  
  56.     TMyApp    =  OBJECT(TAppN)
  57.       constructor Init;
  58.       procedure HandleEvent(var Event : TEvent);  VIRTUAL;
  59.       procedure InitMenuBar;  VIRTUAL;
  60.       procedure OpenWindow;
  61.     end;
  62.  
  63.  
  64. var
  65.     WorkWindow    :  array[1..8000] of byte;  { generic database }
  66.  
  67.  
  68.   { ══ TDmxInterior ══════════════════════════════════════════════════════ }
  69.  
  70.  
  71.      { see documentation on tvDMX's virtual methods if you wish to
  72.        modify your tvDMX view's behavior  }
  73.  
  74.  
  75.   { ══ TMyApp ════════════════════════════════════════════════════════════ }
  76.  
  77.  
  78. constructor TMyApp.Init;
  79. begin
  80.   TAppN.Init;
  81.   OpenWindow;
  82. end;
  83.  
  84.  
  85. procedure TMyApp.HandleEvent(var Event : TEvent);
  86. begin
  87.   TAppN.HandleEvent(Event);
  88.   If Event.What = evCommand then
  89.     begin
  90.     Case Event.Command of
  91.       cmOpenWin:    OpenWindow;
  92.       cmPrint:        PrnCurrentDMX;
  93.       cmPRN_NewPage:    PrnPageStart(Event);
  94.       cmPRN_EndPage:    PrnPageEnd(Event);
  95.       cmPRN_SetOptions:    PrnSetOptions(hcNoContext, hcNoContext, hcNoContext);
  96.      else        Exit;
  97.       end;
  98.     ClearEvent(Event);
  99.     end;
  100. end;
  101.  
  102.  
  103. procedure TMyApp.InitMenuBar;
  104. var  R: TRect;
  105. begin
  106.   GetExtent(R);
  107.   R.B.Y := R.A.Y + 1;
  108.   MenuBar := New(PMenuBar, Init(R, NewMenu(
  109.     NewSubMenu('tv~DMX~', hcNoContext, NewMenu(
  110.       NewItem('~O~pen',  'F4', kbF4, cmOpenWin, hcNoContext,
  111.       NewLine(
  112.       NewSoundItem(hcNoContext,
  113.       NewVideoItem(hcNoContext,
  114.       NewLine(
  115.       NewItem('e~X~it',  'Alt-X',  kbAltX, cmQuit, hcNoContext,
  116.       nil))))))),
  117.     NewSubMenu('~W~indow', hcNoContext, NewMenu(
  118.       NewItem('~S~ize/Move', 'Ctrl-F5', kbCtrlF5, cmResize, hcNoContext,
  119.       NewItem('~Z~oom',      'F5', kbF5,    cmZoom,    hcNoContext,
  120.       NewItem('~T~ile',      '',   kbNoKey, cmTile,    hcNoContext,
  121.       NewItem('C~a~scade',   '',   kbNoKey, cmCascade,    hcNoContext,
  122.       NewItem('~N~ext',      'F6', kbF6,    cmNext,    hcNoContext,
  123.       NewItem('~P~revious', 'Shift-F6', kbShiftF6, cmPrev, hcNoContext,
  124.       NewItem('~C~lose', 'Alt-F3',  kbAltF3, cmClose,    hcNoContext,
  125.       NewLine(
  126.       NewItem('~U~ser screen', 'Alt-F5', kbAltF5, cmUserScreen, hcNoContext,
  127.       nil)))))))))),
  128.     NewSubMenu('~P~rint', hcNoContext, NewMenu(
  129.       NewItem('~P~rint', 'F9', kbF9, cmPrint, hcNoContext,
  130.       StdPrnMenuItems(hcNoContext,
  131.       nil))),
  132.     nil))))
  133.   ));
  134. end;
  135.  
  136.  
  137. procedure TMyApp.OpenWindow;
  138. var  R    : TRect;
  139.      W    : PWindow;
  140. begin
  141.   AssignWinRect(R, length(xLabels) + 2, 0);  { assign window dimensions }
  142.       { width of string xLabels plus two for the border; }
  143.       { zero rows indicates extend to bottom of screen }
  144.  
  145.   New(W, Init(R, 'Work Window', wnNextAvail));
  146.   With W^ do
  147.     begin
  148.     Options := Options or ofTileable; { must be tileable for AssignWinRect }
  149.     GetExtent(R);          { create new rectangle for editor object }
  150.     R.Grow(-1,-1);                  { shrink -1 to avoid borders }
  151.     Inc(R.A.Y, 2);             { make room for TDmxLabels object }
  152.     Insert(New(PDmxInterior,
  153.       Init(xTemplate,                 { template string }
  154.         WorkWindow,                    { working data }
  155.         sizeof(WorkWindow),            { size of working data }
  156.         R,                    { view's rectangle }
  157.         New(PDmxFLabels, InitInsert(W, xLabels)), { label string }
  158.         New(PDmxRecInd, InitInsert(W, 10)),    { indicator width }
  159.         W^.StandardScrollBar(sbHorizontal),
  160.         W^.StandardScrollBar(sbVertical)
  161.         )
  162.     ));
  163.     end;
  164.   DeskTop^.Insert(ValidView(W));
  165. end;
  166.  
  167.  
  168.   { ══════════════════════════════════════════════════════════════════════ }
  169.  
  170. var  MyApp    :  TMyApp;
  171.  
  172.  
  173. Begin
  174.   FillChar(WorkWindow, sizeof(WorkWindow), 0);
  175.  
  176.   MyApp.Init;
  177.   MyApp.Run;
  178.   MyApp.Done;
  179. End.
  180.